import logging

import pygame

from .core import *


class Mouse(SquareSprite):

    def __init__(self):
        super().__init__(Square(Camera.worldpos(pygame.mouse.get_pos()), 1), xmlpath = "profile/anima.cursor.xml")

        pygame.mouse.set_visible(False)
        self.mask = pygame.Mask((1, 1))

        self.anima.scale_to_square_size = False
        self.anima.scale = Vector2(0.5, 0.5)


    def _physics_process(self, delta):
        self.square.center = Camera.worldpos(pygame.mouse.get_pos())





class Container:
    pass





class UI(pygame.sprite.Sprite):

    def __init__(self, master: Container, rel_center, size, **kwargs):
        self.visible = True

        self.master = master

        self.rel_rect = pygame.Rect((0, 0), size)
        self.rel_rect.center = rel_center

        self.font = kwargs.get("font")

        self.bg_color = kwargs.get("color", "black")

        self.border: list = kwargs.get("border", "0 white").split(" ")

        self.image = pygame.Surface(size)
        self.image.fill(self.bg_color)
        if self.border[0] > 0:
            pygame.draw.draw_rect(self.image, self.rect, color=self.border[1], width=self.border[0])

        self.onclick = kwargs.get("onclick", lambda: None)
        self.onhover = kwargs.get("onhover", lambda: None)

    @property
    def rect(self):
        pass

    def _check_if_clicked(self):
        pass

    def active(self):
        pass

    def draw(self, surface):
        pass

    def update(self, *args):
        raise NotImplementedError

    def destory(self):
        pass


